<?php

require_once 'DataProvider.php';
require_once '../dto/AdminDto.php';

class AdminDao {

    public static function GetAdminByEmailAndPassword($email, $password) {
        $sql = "SELECT * " .
                " FROM admin WHERE  strcmp(email,'" . $email . "') = 0 and strcmp(password,'" . $password . "') = 0;";

        $resultquery = DataProvider::ExecuteQuery($sql);
        if ($resultquery == null)
            return null;
        $admin = null;
        while ($row = mysql_fetch_array($resultquery)) {
            $admin = new AdminDto();
            $admin->setEmail($row['email']);
            $admin->setPassword($row['password']);
        }
        return $admin;
    }

}

?>
